package com.amos.log.configure;

import com.amos.log.configure.aspect.LogAspect;
import com.amos.log.configure.properties.LogProperties;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import javax.servlet.http.HttpServlet;

/**
 * @ClassName : LogAutoConfigure
 * @Description : 自动配置类
 * @Author : tianshuo
 * @Date: 2020-11-14 17:26
 */
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@ConditionalOnClass(Aspect.class)
@EnableConfigurationProperties(LogProperties.class)
public class LogAutoConfigure {

    @Bean
    public LogAspect logAspect(LogProperties logProperties) {
        return new LogAspect(logProperties);
    }
}

